package com.movie.demo.Controller;


import com.movie.demo.Mapper.HallMapper;
import com.movie.demo.pojo.Hall;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class HallController {
    @Autowired
    private HallMapper hallMapper;

    @GetMapping("/getAllHalls")
    @ResponseBody
    public String getAllHalls(){

        List<Hall> hallList = hallMapper.getAll();

        StringBuilder stringBuilder = new StringBuilder();
        for(Hall hall : hallList){
            stringBuilder.append(hall.toString());
            stringBuilder.append("\n");
        }

        return stringBuilder.toString();
    }

}
